package com.lyj.validates.dto;

import com.lyj.validates.validates.DateValidator;
import com.lyj.validates.validates.UserValidator;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 用户dto
 * @author:liyajie
 * @createTime:2022/1/20 10:18
 * @version:1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Validated
public class UserDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @NotNull(message = "id不能为空")
    private String id;

    @NotBlank(message = "名称不能为空")
    private String name;

    @NotEmpty(message = "薪水不能为空")
    private String salary;

    @Size(min = 3, max = 3, message="年龄长度为3")
    private String age;

    @NotBlank(message = "创建时间不能为空")
    @DateValidator(expectValue="yyyy-MM-dd HH:mm:ss")
    private String createDate;
}
